﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using CBRSystem.Entities;
using CBRSystem.Data;

#endregion

namespace CBRSystem.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="InstructorProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class InstructorProviderBaseCore : EntityProviderBase<CBRSystem.Entities.Instructor, CBRSystem.Entities.InstructorKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, CBRSystem.Entities.InstructorKey key)
		{
			return Delete(transactionManager, key.InstructorId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_instructorId">The primary key.. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _instructorId)
		{
			return Delete(null, _instructorId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_instructorId">The primary key.. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _instructorId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override CBRSystem.Entities.Instructor Get(TransactionManager transactionManager, CBRSystem.Entities.InstructorKey key, int start, int pageLength)
		{
			return GetByInstructorId(transactionManager, key.InstructorId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_Instructor index.
		/// </summary>
		/// <param name="_instructorId">The primary key.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public CBRSystem.Entities.Instructor GetByInstructorId(System.Int32 _instructorId)
		{
			int count = -1;
			return GetByInstructorId(null,_instructorId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Instructor index.
		/// </summary>
		/// <param name="_instructorId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public CBRSystem.Entities.Instructor GetByInstructorId(System.Int32 _instructorId, int start, int pageLength)
		{
			int count = -1;
			return GetByInstructorId(null, _instructorId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Instructor index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_instructorId">The primary key.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public CBRSystem.Entities.Instructor GetByInstructorId(TransactionManager transactionManager, System.Int32 _instructorId)
		{
			int count = -1;
			return GetByInstructorId(transactionManager, _instructorId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Instructor index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_instructorId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public CBRSystem.Entities.Instructor GetByInstructorId(TransactionManager transactionManager, System.Int32 _instructorId, int start, int pageLength)
		{
			int count = -1;
			return GetByInstructorId(transactionManager, _instructorId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Instructor index.
		/// </summary>
		/// <param name="_instructorId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public CBRSystem.Entities.Instructor GetByInstructorId(System.Int32 _instructorId, int start, int pageLength, out int count)
		{
			return GetByInstructorId(null, _instructorId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_Instructor index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_instructorId">The primary key.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="CBRSystem.Entities.Instructor"/> class.</returns>
		public abstract CBRSystem.Entities.Instructor GetByInstructorId(TransactionManager transactionManager, System.Int32 _instructorId, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByFirstName(System.String _firstName)
		{
			int count = -1;
			return GetByFirstName(null,_firstName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByFirstName(System.String _firstName, int start, int pageLength)
		{
			int count = -1;
			return GetByFirstName(null, _firstName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByFirstName(TransactionManager transactionManager, System.String _firstName)
		{
			int count = -1;
			return GetByFirstName(transactionManager, _firstName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByFirstName(TransactionManager transactionManager, System.String _firstName, int start, int pageLength)
		{
			int count = -1;
			return GetByFirstName(transactionManager, _firstName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByFirstName(System.String _firstName, int start, int pageLength, out int count)
		{
			return GetByFirstName(null, _firstName, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_FirstName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_firstName">The first name (proper name) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public abstract TList<Instructor> GetByFirstName(TransactionManager transactionManager, System.String _firstName, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key IX_Instructor_LastName index.
		/// </summary>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByLastName(System.String _lastName)
		{
			int count = -1;
			return GetByLastName(null,_lastName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_LastName index.
		/// </summary>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByLastName(System.String _lastName, int start, int pageLength)
		{
			int count = -1;
			return GetByLastName(null, _lastName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByLastName(TransactionManager transactionManager, System.String _lastName)
		{
			int count = -1;
			return GetByLastName(transactionManager, _lastName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByLastName(TransactionManager transactionManager, System.String _lastName, int start, int pageLength)
		{
			int count = -1;
			return GetByLastName(transactionManager, _lastName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_LastName index.
		/// </summary>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public TList<Instructor> GetByLastName(System.String _lastName, int start, int pageLength, out int count)
		{
			return GetByLastName(null, _lastName, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the IX_Instructor_LastName index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_lastName">The last name (surname) of the instructor.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="TList&lt;Instructor&gt;"/> class.</returns>
		public abstract TList<Instructor> GetByLastName(TransactionManager transactionManager, System.String _lastName, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#region Instructor_ListInactive 
		
		/// <summary>
		///	This method wrap the 'Instructor_ListInactive' stored procedure. 
		/// </summary>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListInactive()
		{
			return ListInactive(null, 0, int.MaxValue );
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_ListInactive' stored procedure. 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListInactive(int start, int pageLength)
		{
			return ListInactive(null, start, pageLength );
		}
				
		/// <summary>
		///	This method wrap the 'Instructor_ListInactive' stored procedure. 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListInactive(TransactionManager transactionManager)
		{
			return ListInactive(transactionManager, 0, int.MaxValue );
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_ListInactive' stored procedure. 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public abstract TList<Instructor> ListInactive(TransactionManager transactionManager, int start, int pageLength );
		
		#endregion
		
		#region Instructor_Activate 
		
		/// <summary>
		///	This method wrap the 'Instructor_Activate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Activate(System.Int32? instructorId)
		{
			 Activate(null, 0, int.MaxValue , instructorId);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_Activate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Activate(int start, int pageLength, System.Int32? instructorId)
		{
			 Activate(null, start, pageLength , instructorId);
		}
				
		/// <summary>
		///	This method wrap the 'Instructor_Activate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Activate(TransactionManager transactionManager, System.Int32? instructorId)
		{
			 Activate(transactionManager, 0, int.MaxValue , instructorId);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_Activate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void Activate(TransactionManager transactionManager, int start, int pageLength , System.Int32? instructorId);
		
		#endregion
		
		#region Instructor_LookupByPartialLastName 
		
		/// <summary>
		///	This method wrap the 'Instructor_LookupByPartialLastName' stored procedure. 
		/// </summary>
		/// <param name="lastName"> A <c>System.String</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> LookupByPartialLastName(System.String lastName)
		{
			return LookupByPartialLastName(null, 0, int.MaxValue , lastName);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_LookupByPartialLastName' stored procedure. 
		/// </summary>
		/// <param name="lastName"> A <c>System.String</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> LookupByPartialLastName(int start, int pageLength, System.String lastName)
		{
			return LookupByPartialLastName(null, start, pageLength , lastName);
		}
				
		/// <summary>
		///	This method wrap the 'Instructor_LookupByPartialLastName' stored procedure. 
		/// </summary>
		/// <param name="lastName"> A <c>System.String</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> LookupByPartialLastName(TransactionManager transactionManager, System.String lastName)
		{
			return LookupByPartialLastName(transactionManager, 0, int.MaxValue , lastName);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_LookupByPartialLastName' stored procedure. 
		/// </summary>
		/// <param name="lastName"> A <c>System.String</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public abstract TList<Instructor> LookupByPartialLastName(TransactionManager transactionManager, int start, int pageLength , System.String lastName);
		
		#endregion
		
		#region Instructor_ListActive 
		
		/// <summary>
		///	This method wrap the 'Instructor_ListActive' stored procedure. 
		/// </summary>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListActive()
		{
			return ListActive(null, 0, int.MaxValue );
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_ListActive' stored procedure. 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListActive(int start, int pageLength)
		{
			return ListActive(null, start, pageLength );
		}
				
		/// <summary>
		///	This method wrap the 'Instructor_ListActive' stored procedure. 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public TList<Instructor> ListActive(TransactionManager transactionManager)
		{
			return ListActive(transactionManager, 0, int.MaxValue );
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_ListActive' stored procedure. 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Instructor&gt;"/> instance.</returns>
		public abstract TList<Instructor> ListActive(TransactionManager transactionManager, int start, int pageLength );
		
		#endregion
		
		#region Instructor_Deactivate 
		
		/// <summary>
		///	This method wrap the 'Instructor_Deactivate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Deactivate(System.Int32? instructorId)
		{
			 Deactivate(null, 0, int.MaxValue , instructorId);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_Deactivate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Deactivate(int start, int pageLength, System.Int32? instructorId)
		{
			 Deactivate(null, start, pageLength , instructorId);
		}
				
		/// <summary>
		///	This method wrap the 'Instructor_Deactivate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public void Deactivate(TransactionManager transactionManager, System.Int32? instructorId)
		{
			 Deactivate(transactionManager, 0, int.MaxValue , instructorId);
		}
		
		/// <summary>
		///	This method wrap the 'Instructor_Deactivate' stored procedure. 
		/// </summary>
		/// <param name="instructorId"> A <c>System.Int32?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		public abstract void Deactivate(TransactionManager transactionManager, int start, int pageLength , System.Int32? instructorId);
		
		#endregion
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Instructor&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Instructor&gt;"/></returns>
		public static TList<Instructor> Fill(IDataReader reader, TList<Instructor> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				CBRSystem.Entities.Instructor c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Instructor")
					.Append("|").Append((System.Int32)reader[((int)InstructorColumn.InstructorId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Instructor>(
					key.ToString(), // EntityTrackingKey
					"Instructor",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new CBRSystem.Entities.Instructor();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.InstructorId = (System.Int32)reader[((int)InstructorColumn.InstructorId - 1)];
					c.FirstName = (System.String)reader[((int)InstructorColumn.FirstName - 1)];
					c.LastName = (System.String)reader[((int)InstructorColumn.LastName - 1)];
					c.Active = (System.Boolean)reader[((int)InstructorColumn.Active - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="CBRSystem.Entities.Instructor"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Instructor"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, CBRSystem.Entities.Instructor entity)
		{
			if (!reader.Read()) return;
			
			entity.InstructorId = (System.Int32)reader[((int)InstructorColumn.InstructorId - 1)];
			entity.FirstName = (System.String)reader[((int)InstructorColumn.FirstName - 1)];
			entity.LastName = (System.String)reader[((int)InstructorColumn.LastName - 1)];
			entity.Active = (System.Boolean)reader[((int)InstructorColumn.Active - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="CBRSystem.Entities.Instructor"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Instructor"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, CBRSystem.Entities.Instructor entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.InstructorId = (System.Int32)dataRow["InstructorID"];
			entity.FirstName = (System.String)dataRow["FirstName"];
			entity.LastName = (System.String)dataRow["LastName"];
			entity.Active = (System.Boolean)dataRow["Active"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="CBRSystem.Entities.Instructor"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">CBRSystem.Entities.Instructor Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, CBRSystem.Entities.Instructor entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByInstructorId methods when available
			
			#region CourseOfferingCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<CourseOffering>|CourseOfferingCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CourseOfferingCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.CourseOfferingCollection = DataRepository.CourseOfferingProvider.GetByCoordinatorId(transactionManager, entity.InstructorId);

				if (deep && entity.CourseOfferingCollection.Count > 0)
				{
					deepHandles.Add("CourseOfferingCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<CourseOffering>) DataRepository.CourseOfferingProvider.DeepLoad,
						new object[] { transactionManager, entity.CourseOfferingCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region SectionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Section>|SectionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'SectionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.SectionCollection = DataRepository.SectionProvider.GetByInstructorId(transactionManager, entity.InstructorId);

				if (deep && entity.SectionCollection.Count > 0)
				{
					deepHandles.Add("SectionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Section>) DataRepository.SectionProvider.DeepLoad,
						new object[] { transactionManager, entity.SectionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the CBRSystem.Entities.Instructor object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">CBRSystem.Entities.Instructor instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">CBRSystem.Entities.Instructor Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, CBRSystem.Entities.Instructor entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
	
			#region List<CourseOffering>
				if (CanDeepSave(entity.CourseOfferingCollection, "List<CourseOffering>|CourseOfferingCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(CourseOffering child in entity.CourseOfferingCollection)
					{
						if(child.CoordinatorIdSource != null)
						{
							child.CoordinatorId = child.CoordinatorIdSource.InstructorId;
						}
						else
						{
							child.CoordinatorId = entity.InstructorId;
						}

					}

					if (entity.CourseOfferingCollection.Count > 0 || entity.CourseOfferingCollection.DeletedItems.Count > 0)
					{
						//DataRepository.CourseOfferingProvider.Save(transactionManager, entity.CourseOfferingCollection);
						
						deepHandles.Add("CourseOfferingCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< CourseOffering >) DataRepository.CourseOfferingProvider.DeepSave,
							new object[] { transactionManager, entity.CourseOfferingCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<Section>
				if (CanDeepSave(entity.SectionCollection, "List<Section>|SectionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Section child in entity.SectionCollection)
					{
						if(child.InstructorIdSource != null)
						{
							child.InstructorId = child.InstructorIdSource.InstructorId;
						}
						else
						{
							child.InstructorId = entity.InstructorId;
						}

					}

					if (entity.SectionCollection.Count > 0 || entity.SectionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.SectionProvider.Save(transactionManager, entity.SectionCollection);
						
						deepHandles.Add("SectionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Section >) DataRepository.SectionProvider.DeepSave,
							new object[] { transactionManager, entity.SectionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region InstructorChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>CBRSystem.Entities.Instructor</c>
	///</summary>
	public enum InstructorChildEntityTypes
	{

		///<summary>
		/// Collection of <c>Instructor</c> as OneToMany for CourseOfferingCollection
		///</summary>
		[ChildEntityType(typeof(TList<CourseOffering>))]
		CourseOfferingCollection,

		///<summary>
		/// Collection of <c>Instructor</c> as OneToMany for SectionCollection
		///</summary>
		[ChildEntityType(typeof(TList<Section>))]
		SectionCollection,
	}
	
	#endregion InstructorChildEntityTypes
	
	#region InstructorFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;InstructorColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Instructor"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class InstructorFilterBuilder : SqlFilterBuilder<InstructorColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the InstructorFilterBuilder class.
		/// </summary>
		public InstructorFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the InstructorFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public InstructorFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the InstructorFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public InstructorFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion InstructorFilterBuilder
	
	#region InstructorParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;InstructorColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Instructor"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class InstructorParameterBuilder : ParameterizedSqlFilterBuilder<InstructorColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the InstructorParameterBuilder class.
		/// </summary>
		public InstructorParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the InstructorParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public InstructorParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the InstructorParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public InstructorParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion InstructorParameterBuilder
	
	#region InstructorSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;InstructorColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Instructor"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class InstructorSortBuilder : SqlSortBuilder<InstructorColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the InstructorSqlSortBuilder class.
		/// </summary>
		public InstructorSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion InstructorSortBuilder
	
} // end namespace
